var cookieV;
var strcookie = document.cookie;//获取cookie字符串
var arrcookie = strcookie.split(";");//分割
//遍历匹配
for ( var i = 0; i < arrcookie.length; i++) {
    var arr = arrcookie[i].split("=");
    if(arr[0].trim()=="frontCommonUser"){
        //存储登录信息的cookie值
        cookieV=arr[1].trim();
        break;
    }
}

var topVue = new Vue({
    el:"#top",
    data:{
        commonUser:{}
    },
    methods:{
        getUserInfo:function () {
            var vueObj=this;
            const url="/user/getUserInfo";
            let datas = {params:{"cookieV":cookieV}};
            if(null!=cookieV){
                axios.get(url,datas).then(function(resp){
                    if(resp.data.status!=200){
                        alert(resp.data.msg);
                        $(".noLogin").show();
                    }else{
                        vueObj.commonUser=resp.data.data;
                        $(".noLogin span").html();
                        $(".noLogin span").html("<a href=\"user/loginOut\">[退出登录]</a>");
                    }
                })
            }
        },
    },created:function () {
        this.getUserInfo();
    }
})